﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;

namespace FastCodeGeneration.Core.Utility
{
    public static class StringUtility
    {
        public static string ToCamelToUnderline(this string str)
        {
            var rgx = @"(?x)( [A-Z][a-z,0-9]+ | [A-Z]+(?![a-z]) )";

            return Regex.Replace(str, rgx, "_$0").ToUpper().TrimStart('_');
        }

        public static bool IsEmpty(this string str)
        {
            return string.IsNullOrEmpty(str);
        }
        public static bool IsNotEmpty(this string str)
        {
            return !str.IsEmpty();
        }

        public static bool IsBlank(this string str)
        {
            return str == null || str.Trim().Length == 0;
        }

        public static bool IsNotBlank(this string str)
        {
            return !str.IsBlank();
        }

    }
}
